#ifndef RC_h
#define RC_h

#define NUM_CHANNELS 8
#define MIN_PULSEWIDTH   900
#define TRIM_PULSEWIDTH 1500
#define MAX_PULSEWIDTH  2100
#define CH_1 0
#define CH_2 1
#define CH_3 2
#define CH_4 3
#define CH_5 4
#define CH_6 5
#define CH_7 6
#define CH_8 7

#include <inttypes.h>

class RadioControl
{
  private:
  public:
	RadioControl();
	// Public arrays
	uint16_t CH_UpperLimit[NUM_CHANNELS];
	uint16_t CH_NeutralPosition[NUM_CHANNELS];
	uint16_t CH_LowerLimit[NUM_CHANNELS];
	uint16_t CH_In[NUM_CHANNELS];
	uint16_t CH_Out[NUM_CHANNELS];
	// Public methods
	void Init();
	void OutputCh(unsigned char ch, uint16_t pwm);
	uint16_t InputCh(unsigned char ch);
	void InputAllCh(void);
	void OutputAllCh(void);
	unsigned char GetState();
	// ArduCopter
	void Force_Out0_Out1(void);
	void Force_Out2_Out3(void);
	void Force_Out6_Out7(void);
};
#endif
